<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // on订阅 emit发布
        // 邮局
        let e = {
            callbackList : [],
            on(fn){
                this.callbackList.push(fn)
            },
            emit(value){
                this.callbackList.forEach(method => {
                    method(value)
                })
            }
        }
        e.on(function(value){
            console.log('张三订阅了:'+value);
        })
        e.on(function(value){
            console.log('李四订阅了:'+value);
        })
        e.on(function(value){
            console.log('王五订阅了:'+value);
        })

        e.emit("中央日报")
        


    </script>
</body>
</html>